package com.comac.print.component.app.handler;

import com.alibaba.cola.dto.Response;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 *  404异常处理
 * @author cyg
 */
@Controller
public class NotFoundController implements ErrorController {
    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping(value ={"/error"})
    @ResponseBody
    public Response error(HttpServletRequest request){
        return Response.buildFailure("404","Not Found");
    }
}
